package com.sali.b_design_pattern.m_status_pattern;

import com.sali.b_design_pattern.m_status_pattern.service.MyState;
import com.sali.b_design_pattern.m_status_pattern.service.impl.OffState;


// 上下⽂类
public class LightContext {

    private MyState state; // 当前状态

    public LightContext() {
        this.state = new OffState(); // 初始状态为关闭
    }

    public void setState(MyState state) { // 设置新的状态
        this.state = state;
    }

    public String performOperation() { // 执⾏当前状态的操作
        return state.handle();
    }

}
